Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Write debug-level log to local file in Sandbox #1846

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

spalladino
Copy link
Collaborator

Writes all debug logs, regardless of LOG_LEVEL or DEBUG, to a local file in ./log when running the Sandbox. If run within Docker, the log folder is mounted locally so the user can access the logs without having to manually connect to the container.

Logs are outputted using winston's daily-rotate-file to prevent logs from growing out of control, and formatted as ndjson, including level, namespace, and timestamp. Note that the winston dependency is only added to the sandbox package, all other packages still use foundation's plain log.

Example log:

$ head -n10 log/aztec-sandbox.debug.log 
{"level":"info","message":"Setting up Aztec Sandbox, please stand by...","namespace":"aztec:sandbox","timestamp":"2023-08-28T18:49:51.961Z"}
{"level":"info","message":"Deploying rollup contracts to L1...","namespace":"aztec:sandbox","timestamp":"2023-08-28T18:49:51.962Z"}
{"level":"debug","message":"Deploying contracts...","namespace":"aztec:sandbox","timestamp":"2023-08-28T18:49:51.981Z"}
{"level":"debug","message":"Deployed Registry at 0x5fbdb2315678afecb367f032d93f642f64180aa3","namespace":"aztec:sandbox","timestamp":"2023-08-28T18:49:52.003Z"}
{"level":"debug","message":"Deployed Inbox at 0xe7f1725e7734ce288f8367e1bb143e90bb3f0512","namespace":"aztec:sandbox","timestamp":"2023-08-28T18:49:52.020Z"}
{"level":"debug","message":"Deployed Outbox at 0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0","namespace":"aztec:sandbox","timestamp":"2023-08-28T18:49:52.033Z"}
{"level":"debug","message":"Deployed Rollup at 0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9","namespace":"aztec:sandbox","timestamp":"2023-08-28T18:49:52.048Z"}
{"level":"debug","message":"Deployed contract deployment emitter at 0x5fc8d32690cc91d4c39d9d3abcbd16989f875707","namespace":"aztec:sandbox","timestamp":"2023-08-28T18:49:52.060Z"}
{"level":"debug","message":"Performing initial chain sync...","namespace":"aztec:archiver","timestamp":"2023-08-28T18:49:52.061Z"}
{"level":"debug","message":"Adding pending l1 to l2 messages to store","namespace":"aztec:archiver","timestamp":"2023-08-28T18:49:52.081Z"}

Fixes #1605

@kevaundray
Copy link
Contributor

Out of curiousity: what does the aztec namespace differentiate between? I'm guessing that bb.js logs would start with barretenberg and not aztec 🤔

@spalladino
Copy link
Collaborator Author

It's used to only output Aztec logs to the console when configuring debug. If you set DEBUG='aztec:*', you'll get logs in your console about Aztec only. If you set DEBUG='*', you'll also get logs from libraries that Aztec depend on. For example, if you run a test using DEBUG='*', you get jest logs as well (the testing library).

@spalladino spalladino enabled auto-merge (squash) August 28, 2023 21:36
@socket-security
Copy link

New dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
winston-daily-rotate-file 4.7.1 eval, filesystem +20 5.9 MB mattberther
winston 3.10.0 eval, network, filesystem +16 1.53 MB dabh

@spalladino spalladino merged commit 0317e93 into master Aug 29, 2023
@spalladino spalladino deleted the palla/sandbox-log branch August 29, 2023 08:03
PhilWindle pushed a commit that referenced this pull request Aug 30, 2023
🤖 I have created a new Aztec Packages release
---


##
[0.1.0-alpha48](v0.1.0-alpha47...v0.1.0-alpha48)
(2023-08-30)


### Features

* Add ARM build for Mac + cleanup artifacts
([#1837](#1837))
([270a4ae](270a4ae))
* broadcasting 'public key' and 'partial address' as L1 calldata
([#1801](#1801))
([78d6444](78d6444)),
closes
[#1778](#1778)
* Check sandbox version matches CLI's
([#1849](#1849))
([7279730](7279730))
* **docs:** adding some nitpick suggestions before sandbox release
([#1859](#1859))
([c1144f7](c1144f7))
* More reliable getTxReceipt api.
([#1793](#1793))
([ad16b22](ad16b22))
* **noir:** use `#[aztec(private)]` and `#[aztec(public)` attributes
([#1735](#1735))
([89756fa](89756fa))
* Recursive fn calls to spend more notes.
([#1779](#1779))
([94053e4](94053e4))
* Simulate enqueued public functions and locate failing constraints on
them
([#1853](#1853))
([a065fd5](a065fd5))
* Update safe_math and move to libraries
([#1803](#1803))
([b10656d](b10656d))
* Write debug-level log to local file in Sandbox
([#1846](#1846))
([0317e93](0317e93)),
closes
[#1605](#1605)


### Bug Fixes

* Conditionally compile base64 command for bb binary
([#1851](#1851))
([be97185](be97185))
* default color to light mode
([#1847](#1847))
([4fc8d39](4fc8d39))
* Disallow unregistered classes in JSON RPC interface and match by name
([#1820](#1820))
([35b8170](35b8170))
* Set side effect counter on contract reads
([#1870](#1870))
([1d8881e](1d8881e)),
closes
[#1588](#1588)
* Truncate SRS size to the amount of points that we have downloaded
([#1862](#1862))
([0a7058c](0a7058c))


### Miscellaneous

* add browser test to canary flow
([#1808](#1808))
([7f4fa43](7f4fa43))
* **ci:** fix output name in release please workflow
([#1858](#1858))
([857821f](857821f))
* CLI tests
([#1786](#1786))
([2987065](2987065)),
closes
[#1450](#1450)
* compile minimal WASM binary needed for blackbox functions
([#1824](#1824))
([76a30b8](76a30b8))
* fixed linter errors for `ecc`, `numeric` and `common` modules
([#1714](#1714))
([026273b](026273b))
* Refactor Cli interface to be more unix-like
([#1833](#1833))
([28d722e](28d722e))
* sync bb master
([#1842](#1842))
([2c1ff72](2c1ff72))
* sync bb master
([#1852](#1852))
([f979878](f979878))
* sync bb master
([#1866](#1866))
([e681a49](e681a49))
* typescript script names should be consistent
([#1843](#1843))
([eff8fe7](eff8fe7))
* use 2^19 as `MAX_CIRCUIT_SIZE` for NodeJS CLI
([#1834](#1834))
([c573282](c573282))


### Documentation

* Account contract tutorial
([#1772](#1772))
([0faefba](0faefba))
* Wallet dev docs
([#1746](#1746))
([9b4281d](9b4281d)),
closes
[#1744](#1744)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Make it easy to retrieve sandbox debug logs from a user
3 participants